#include<stdio.h>
int main()
{
	int c;
    int a[10]={1,2,3,4,5,6,7,8,9,10};
    int search(int b[],int k,int n);
    c=search(a,9,9);
    printf("9所在逻辑位置为%d",c);
}
int search(int b[],int k,int n)
{
    int mid,low,high;
    low=0;high=n-1;mid=(low+high)/2;
    while(low<=high)
        if(k==b[mid])
            return mid+1;
        if(k>b[mid])
        {
            low=mid+1;
            mid=(low+high)/2;
        }
        else
            high=mid-1;
            mid=(low+high)/2;
	return 0;    
}